package com.richard.demo.service;

import com.richard.demo.dao.StudentDao;
import com.richard.demo.entity.StudentInfoEntity;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;

@Component

public class StudentInfoService {
    @Autowired // 自动装配
    StudentDao studentDao;

    public static StudentInfoService studentInfoService;

    @PostConstruct
    public void init() {
        studentInfoService = this;
        studentInfoService.studentDao = this.studentDao;
    }

    /*
    * 供外界调用
    * */
    public List<StudentInfoEntity> getStudentInfo(String stuId) {
        return studentInfoService.studentDao.getStudentName(stuId);
    }
    public int insertStudentInfo(String stuId,String stuName,String className){
        return studentInfoService.studentDao.insertStudentInfo(stuId,stuName,className);
    }
    public int updateStudentAGE(String stuId){
        return studentInfoService.studentDao.updateStudentAGE(stuId);
    }
    public int deleteStudentInfo(String stuId){
        return studentInfoService.studentDao.deleteStudentInfo(stuId);
    }
}
